-
Notifications
You must be signed in to change notification settings - Fork 469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BT] add BetterTransformer
support for ViLT architecture
#508
[BT] add BetterTransformer
support for ViLT architecture
#508
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Thank you very much for adding BetterTransformer
support for ViLT
model!
I think we need 2 more additional steps before merging:
1- Could you add a new class on the testing suite since the model expected text + image. So inside tests_bettertransformer_vision.py
you can just add something like:
ALL_VISION_TEXT_MODELS_TO_TEST = ("hf-internal-testing/tiny-random-ViltModel")
class BetterTransformersViLTTest(BetterTransformersTestMixin, unittest.TestCase):
r"""
Testing suite for Vision Models - tests all the tests defined in `BetterTransformersTestMixin`
"""
all_models_to_test = ALL_VISION_TEXT_MODELS_TO_TEST
def prepare_inputs_for_class(self, model_id=None):
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
processor = AutoProcessor.from_pretrained("hf-internal-testing/tiny-random-ViltModel")
....
return inputs
And tweak the function prepare_inputs_for_class
based on this example: https://huggingface.co/dandelin/vilt-b32-finetuned-vqa
2- Can you add the new architecture on the documentation? 🙏 this would require adding just a line here (don't forget to respect the alphabetical order ;) )
Also don't forget to run make style
before pushing! ;)
Thanks a bunch!
The documentation is not available anymore as the PR was closed or merged. |
Co-authored-by: Younes Belkada <[email protected]>
BetterTransformer
support for ViLT architecture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very clean and super fast implementation of ViLT
support for BetterTransformer
! Thanks also for taking care of slightly refactoring the documentation.
Thanks a lot for adding this, you really did a great job here! 💪
I have nothing to add on my side, gently pinging @fxmarty and @michaelbenayoun for a last review!
@younesbelkada Thank you for your support and making this first contribution so smooth 😄 Glad I could help 💪 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What does this PR do?
Added BetterTransformer support for ViLT architecture.
Added test model for ViltModel.
Tested the conversion of ViltLayer:
To: @younesbelkada @michaelbenayoun @fxmarty